#ifndef __CAMERA_H_
#define __CAMERA_H_
#include "stdbool.h"

#define AUTO_DISTANCE_MINUS_ROADBLOCK 300
#define AUTO_DISTANCE_MINUS_POINT 400

typedef enum{
 CAMERA_CMD_FIND_LINE =0x04,  //正常寻线
 CAMERA_CMD_FIND_LINE_BACK= 0x10, //倒车寻线
 CAMERA_CMD_SHORT_FIND_NODE  = CAMERA_CMD_FIND_LINE | 0x02, //近距离找点
 CAMERA_CMD_MIDDLE_FIND_NODE = CAMERA_CMD_FIND_LINE | 0x01, //中距离找点
 CAMERA_CMD_REMOTE_FIND_NODE = CAMERA_CMD_FIND_LINE | 0x03, //远距离找点
 CAMERA_CMD_QR= 0x70,  //二维码识别
 CAMERA_CMD_BRIDGE= 0x08,  //桥梁识别
 CAMERA_CMD_SEESAW = 0x20,  //跷跷板寻线
 TRACE_R_CMD_FIND_LINE =0x40,  //跟踪
 TRACE_L_CMD_FIND_LINE =0x44,  //跟踪
 KNIFE_CMD_FIND_LINE =0x50,  //刀山
 CAMERA_CMD_PLATFORM_ADJUST =0x60,  //平台校正
 CAMERA_CMD_PLATFORM = 0x24, //平台矫正
 CAMERA_CMD_NUMBER = 0x0C,  //数字识别
 CAMERA_CMD_GET_DISTANCE_POINT = 0x28,//摄像头获取距离(查找点)
 CAMERA_CMD_GET_DISTANCE_ROADBLOCK = 0x38,//摄像头获取距离(查找障碍)
}CameraCmd_t;
#include "usart_port.h"
extern USART_Data usartCamera;
extern CameraCmd_t cameraCmd;

int getLineRank();
int getOldLineRank();
bool getIsFindNode();
void camera_init(void);
void camera_SendCommand(CameraCmd_t cmd);
int json_parsedInt(char* str,char* key);
uint8_t getRightNumber();
uint8_t getNumber();
uint16_t getqrcode();
int32_t getRoadBlockDistance(CameraCmd_t cmd);
#endif // !__CAMERA_H_